import mailsystem.Connection;
import mailsystem.ConsoleInterface;
import mailsystem.MailSystem;
import mailsystem.Telephone;
import mailsystem.WindowInterface;
import mailsystem.persistance.MailsystemPersistance;


/**
 * This program tests the mail system. A single phone communicates with the
 * program through System.in/System.out.
 */
public class MailSystemTester {
	public static void main(String[] args) {
		MailsystemPersistance repository = new MailsystemPersistance(MailsystemPersistance.DBMODE, MAILBOX_COUNT);
		MailSystem system = new MailSystem(repository);
		
		Telephone console1 = new ConsoleInterface();
		Telephone console2 = new WindowInterface();
		
		Connection c = new Connection(system);
		
		c.addPhone(console1);
		c.addPhone(console2);
		
		console2.run(c);
		console1.run(c);
	}

	private static final int MAILBOX_COUNT = 20;
}
